<template>
  <div>
    <GFormCreator :config="conf" @submit="createLoan" />
    <!-- <hr />
    <GFormCreator ref="f2" :config="conf">
      <template #btn="{ t }">
        <el-button @click="test1"> 提交{{ t }}</el-button>
      </template>
    </GFormCreator>-->
    <!-- <button @click="createLoan">测试添加</button> -->
  </div>
</template>

<script>
import conf from './loan-input-page'
import { createLoanApi } from '@/api/loan'
export default {
  name:'loan-input',
  beforeDestroy(){
    console.log(this.$options.name+"被销毁了")
  },
  data() {
    return {
      conf,
    }
  },
  methods: {
    test1() {
      console.log(this.$refs.f2.getData())
    },
    async createLoan(user) {
      // console.log('数据:', user)
      // user = {
      //   name: 'GRE88',
      //   birthday: '2023-02-01T16:00:00.000Z',
      //   sex: 'man',
      //   identity_card: 'GRE12',
      //   marriage: 'married',
      //   education: 'college',
      //   address1: 'GRE12',
      //   address2: 'GRE12',
      //   phone: 'GRE12',
      //   mobile_phone: 'GRE12',
      //   company: 'GRE12',
      //   trade: 'education',
      //   position: 'GRE12',
      //   address3: 'GRE12',
      //   company_type: 'GRE12',
      //   company_email: 'GRE12',
      //   company_phone: 'GRE12',
      //   income: 'GRE12',
      //   contact: 'GRE12',
      //   contact_name: 'GRE12',
      //   contact_phone: 'GRE12',
      //   contact2: 'GRE12',
      //   contact2_name: 'GRE12',
      //   contact2_phone: 'GRE12',
      //   contact2_dep: 'GRE12',
      //   contact2_pos: 'GRE12',
      //   remark: '123',
      // }
      let res = await createLoanApi(user)
      this.$notify.success('添加成功')
    },
  },
}
</script>
